![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
datocms-structured-text-utils
Advanced tools
A set of Typescript types and helpers to work with DatoCMS Structured Text fields
The datocms-structured-text-utils package provides utilities for working with DatoCMS's structured text format. It allows developers to parse, manipulate, and render structured text content in a flexible and efficient manner.
Rendering Structured Text
This feature allows you to render structured text documents into HTML. The code sample demonstrates how to convert a simple structured text document into an HTML paragraph.
const { render } = require('datocms-structured-text-utils');
const document = {
schema: 'dast',
document: {
type: 'root',
children: [
{
type: 'paragraph',
children: [{ type: 'span', value: 'Hello, world!' }]
}
]
}
};
const html = render(document);
console.log(html); // Outputs: <p>Hello, world!</p>
Transforming Structured Text
This feature allows you to transform structured text documents. The code sample shows how to transform the text content of a paragraph to uppercase.
const { transform } = require('datocms-structured-text-utils');
const document = {
schema: 'dast',
document: {
type: 'root',
children: [
{
type: 'paragraph',
children: [{ type: 'span', value: 'Hello, world!' }]
}
]
}
};
const transformedDocument = transform(document, {
paragraph: ({ children }) => ({
type: 'paragraph',
children: [{ type: 'span', value: children[0].value.toUpperCase() }]
})
});
console.log(transformedDocument);
Slate is a completely customizable framework for building rich text editors. It provides a more general-purpose solution for handling rich text, whereas datocms-structured-text-utils is specifically tailored for DatoCMS's structured text format.
Draft.js is a framework for building rich text editors in React. It offers a comprehensive set of tools for managing editor state and rendering, similar to datocms-structured-text-utils, but is more focused on providing a complete editor experience.
ProseMirror is a toolkit for building rich text editors with a focus on extensibility and customizability. Like datocms-structured-text-utils, it allows for manipulation and rendering of text content, but it is more focused on providing a full editor framework.
datocms-structured-text-utils
TODO: description
const datocmsStructuredTextUtils = require('datocms-structured-text-utils');
// TODO: DEMONSTRATE API
FAQs
A set of Typescript types and helpers to work with DatoCMS Structured Text fields.
The npm package datocms-structured-text-utils receives a total of 0 weekly downloads. As such, datocms-structured-text-utils popularity was classified as not popular.
We found that datocms-structured-text-utils demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.